<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var findDisappearedNumbers = function(nums) {
        let len = nums.length;
        if(len == 0)return nums;
        nums.sort(function(a,b){
            return a-b;
        })
        let arr = [],flag = 0,len1=len;
        if(nums[len1-1]!=len1){
            flag = 1;
            nums.push(len1);
            len++;
        }
        if(nums[0]!=1){
            arr.push(1);
            nums.unshift(1);
            len++;
        }
        for(let i=0; i<len-1; i++){
            if(nums[i+1]-nums[i]>1){
                for(let j=0; j<(nums[i+1]-nums[i]-1); j++){
                    arr.push(nums[i]+1+j);
                }
            }
        }
        if(flag==1)arr.push(len1);
        return arr;
    };
    let a = [1,1,1];
    console.log(findDisappearedNumbers(a));
    
</script>
</html>